-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
solution #1603
base: master
Are you sure you want to change the base?
solution #1603
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a blank page by your DEMO link.
And I don't see your Person
component in your PR. Could you check if you successfully commit and push your changes? And check your DEMO, please.
This reverts commit c6146ed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work!
Let's improve a little bit your code.
src/App.jsx
Outdated
<p className="Person__partner">Natasha is my wife</p> | ||
</section> | ||
<Person | ||
className="Person__name" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to use the className
prop here because:
- you don't use this prop in
Person
component; - you have already used this class inside
Person
JSX.
src/components/Person/Person.jsx
Outdated
{ | ||
person.isMarried ? ( | ||
<p className="Person__partner"> | ||
{person.sex === 'm' ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bad practice to use nested ternary operators.
You can separate this logic into two parts. First: create variable const marriedStatus = person.sex === 'm' ? ... : ...
. Second: use ternary here in JSX:
<p className="Person__partner">{person.isMarried ? marriedStatus : 'I am not married'}</p>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/components/Person/Person.jsx
Outdated
{ | ||
person.isMarried ? ( | ||
<p className="Person__partner"> | ||
{person.sex === 'm' ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check comment above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work!!!
https://denys2.github.io/react_person/